package Interceptor;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;

public class MangerInterceptor implements Interceptor {
    @Override
    public void intercept(Invocation invocation) {
        System.out.println("before"+invocation.getActionKey());
        String isLogin = invocation.getController().getSessionAttr("isLogin");
        if (!"1".equals(isLogin)){
            invocation.getController().redirect("/login");
        }else{
            invocation.invoke();
            System.out.println("after"+invocation.getActionKey());
        }
    }
}
